package cn.stylefeng.guns.modular.business.frequency.orderfinishimage.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import cn.stylefeng.guns.modular.business.frequency.orderfinishimage.entity.OrderFinishImage;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * 订单交付图片 Mapper 接口
 *
 * @author yujie
 * @date 2023/05/09 17:16
 */
public interface OrderFinishImageMapper extends BaseMapper<OrderFinishImage> {


    List<String> getImageByIdAndType(@Param("id") String id, @Param("type") Integer type);

    @Select("SELECT " +
            "ofi.url " +
            "FROM " +
            "tt_order_finish_record_detail ofrd " +
            "LEFT JOIN tt_order_finish_record ofr ON ofr.id = ofrd.finish_record_id " +
            "LEFT JOIN tt_order_finish_image ofi ON ofi.finish_id = ofr.id  " +
            "WHERE " +
            "ofrd.order_id = #{orderId} " +
            "AND ofi.type = #{type}")
    List<String> getImageByOrderIdAndType(@Param("orderId") Long orderId, @Param("type") int type);
}